<?php

namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Session;
use think\Request;

class Node extends Admincoetroller
{
    //加载节点详情页
   public function index()
    {
        
        $sql=db('node')->select();
        // var_dump($sql);
        // die;
        return $this->fetch('user/node',['userlist'=>$sql]);
    }



    //加载节点添加页面
    public function donode()
    {   

       
        return $this->fetch('user/dorole');
    }

    //节点添加操作
    public function doroles(Request $request)
    {
        $sql = $request->post();
        $sql['status']='1';
        // var_dump($sql);
        // die;
        Db::name('node')->insert($sql);
        return $this->success('成功',url('admin/node/index'));

    } 


    //节点删除
    public function beleteoles($id)
    {
        // var_dump($id);
        
        $sql=Db::name('node')->delete(['id'=>$id]);
        return $this->success('删除成功');

    }



}
